package com.huage.courseplatform.satoken.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huage.courseplatform.satoken.mapper.RoleMapper;
import com.huage.courseplatform.satoken.model.entity.Role;
import com.huage.courseplatform.satoken.service.RoleService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Resource
    RoleMapper roleMapper;


    @Override
    @Cacheable(cacheNames="Service:RoleService:userId",key = "#userId",unless="#result == null")
    public List<Role> getRoleListByUserId(String userId) {
        return roleMapper.getRoleListByUserId(userId);
    }
}
